package com.ict.web.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 审核对象 yzq_approval
 * 
 * @author ruoyi
 * @date 2022-02-24
 */
@Data
@TableName("yzq_approval")
@NoArgsConstructor
@AllArgsConstructor
public class Approval implements Serializable
{
    private static final long serialVersionUID = 1L;

    public static final String DELETE_STATUS_NORMAL = "0";
    public static final String DELETE_STATUS_UNNORMAL = "1";

    /**评审对象类型（0:三方）*/
    public static final String APPROVAL_TYPE_THIRD = "0";
    /**评审对象类型（1:专家）*/
    public static final String APPROVAL_TYPE_EXPERT= "1";
    /**评审对象类型（2:项目管理）*/
    public static final String APPROVAL_TYPE_PROJECT_MANAGE = "2";
    /**评审对象类型（3:项目单位）*/
    public static final String APPROVAL_TYPE_PROJECT_UNIT = "3";
    /**评审对象类型（4:年度计划）*/
    public static final String APPROVAL_TYPE_PLAN = "4";


    /**审核结果（1:通过）*/
    public static final String APPROVAL_RESULT_PASS = "1";
    /**审核结果（5:通过需修改）*/
    public static final String APPROVAL_RESULT_BACK_UPDATE = "5";

    /**审批id*/
    @ApiModelProperty(value = "审批id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableId(value = "approval_id",type = IdType.AUTO)
    private Long approvalId;

    /**评审任务id*/
    @ApiModelProperty(value = "评审任务id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long reviewTaskId;

    /**项目id*/
    @ApiModelProperty(value = "项目id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long projectId;

    /**评审对象类型（0:三方1:专家2:项目管理3:项目单位）*/
    @ApiModelProperty(value = "评审对象类型（0:三方1:专家2:项目管理3:项目单位）")
    private String approvalType;

    /**阶段*/
    @ApiModelProperty(value = "阶段")
    private String approvalStage;

    /**节点*/
    @ApiModelProperty(value = "节点")
    private String approvalNode;

    /**开始时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    @ApiModelProperty(value = "开始时间")
    private LocalDateTime startTime;

    /**结束时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    @ApiModelProperty(value = "结束时间")
    @TableField(updateStrategy  = FieldStrategy.IGNORED)
    private LocalDateTime endTime;

    /**操作人*/
    @ApiModelProperty(value = "操作人")
    private String approvalOperator;

    /**状态*/
    @ApiModelProperty(value = "状态")
    private String approvalStatus;

    /**操作/申报详情操作*/
    @ApiModelProperty(value = "操作/申报详情操作")
    private String approvalOperation;

    /**审批意见*/
    @ApiModelProperty(value = "审批意见")
    private String approvalOpinion;

    /**审核结果*/
    @ApiModelProperty(value = "审核结果")
    private String approvalResult;

    /**资料库*/
    @ApiModelProperty(value = "资料库{文件的url}")
    @TableField(updateStrategy  = FieldStrategy.IGNORED)
    private String approvalDatabase;

    /**删除状态*/
    @ApiModelProperty(value = "删除状态（0:正常1:删除）")
    private String delFlag;

    /**创建时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**更新时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    /**专家id*/
    @ApiModelProperty(value = "专家id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long expertId;

    /**年度项目id*/
    @ApiModelProperty(value = "年度项目id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long planId;

    public Approval(Long approvalId, Long proId, String approvalStage, String approvalNode,LocalDateTime startTime,LocalDateTime endTime,String approvalOperator,String approvalStatus,String approvalOperation,String approvalOpinion, String approvalResult, String approvalDatabase, LocalDateTime createTime,String approvalType) {
        this.approvalId=approvalId;
        this.projectId=proId;
        this.approvalStage=approvalStage;
        this.approvalNode=approvalNode;
        this.createTime=createTime;
        this.approvalOpinion=approvalOpinion;
        this.approvalResult=approvalResult;
        this.approvalStatus=approvalStatus;
        this.startTime=startTime;
        this.endTime=endTime;
        this.approvalOperator=approvalOperator;
        this.approvalOperation=approvalOperation;
        this.approvalDatabase=approvalDatabase;
        this.approvalType=approvalType;
        this.delFlag=ExtractExpert.DELETE_STATUS_NORMAL;
    }
    //专家审核进程
    public Approval(Long approvalId, Long proId, String approvalStage, String approvalNode,LocalDateTime startTime,LocalDateTime endTime,String approvalOperator,String approvalStatus,String approvalOperation,String approvalOpinion, String approvalResult, String approvalDatabase, LocalDateTime createTime,String approvalType, Long expertId, Long planId) {
        this.approvalId=approvalId;
        this.projectId=proId;
        this.approvalStage=approvalStage;
        this.approvalNode=approvalNode;
        this.createTime=createTime;
        this.approvalOpinion=approvalOpinion;
        this.approvalResult=approvalResult;
        this.approvalStatus=approvalStatus;
        this.startTime=startTime;
        this.endTime=endTime;
        this.approvalOperator=approvalOperator;
        this.approvalOperation=approvalOperation;
        this.approvalDatabase=approvalDatabase;
        this.approvalType=approvalType;
        this.delFlag=ExtractExpert.DELETE_STATUS_NORMAL;
        this.expertId=expertId;
        this.planId=planId;
    }
}
